<template>
	<view class="pagesBox">
		<view class="pagesMain">
			<view class="jifenBox">
				<view class="jifenTitle">积分</view>
				<view class="jifenNum">{{scoreInfo.score || "0.00"}}</view>
				<!-- <view class="rechargeBtn" hover-class="rechargeHover" @click="toRechange">去充值</view> -->
			</view>
			<view class="cardNoBox">
				<view class="cardNoTitle">我的银行卡</view>
				<view class="cardNoRight">
					<view class="addCardNo" v-if="!scoreInfo.bank_number" @click="toAddBank"><u-icon name="plus-circle-fill" color="#5e2400" size="30"></u-icon>添加银行卡</view>
					<view class="bankBox" v-if="scoreInfo.bank_number" @click="toAddBank">
						<view class="bankName">{{scoreInfo.bank_account}}</view>
						<view class="bankNum">{{scoreInfo.bank_number}}</view>
					</view>
					<!-- <view style="color: #000;font-weight: 500;" @click="toBankList">查看<u-icon name="arrow-right" color="#000" size="28"></u-icon></view> -->
				</view>
			</view>
			<view class="myOrderBox">
				<view class="titleBox">
				    <view class="titleLeft">积分</view>
				</view>
				<view class="menuBox">
					<block v-for="(item,index) in menuList" :key="index">
						<view class="menuItem" @click="toPage(item)">
							<view class="menuImage">
								<image :src="item.image" style="width: 74rpx;height: 74rpx;"></image>
								<u-badge type="error" size="mini" :count="item.num" :offset="[-5,-15]"></u-badge>
							</view>
							<view class="menuText">{{item.text}}</view>
						</view>
					</block>
					<view class="menuItem"></view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				baseUrl:this.$baseUrl,
				menuList:[
					{image:this.$baseUrl+'/static/my/icon12.png',url:'/pagesMy/jifen/turn',text:'积分互转',num:0},
					{image:this.$baseUrl+'/static/my/icon13.png',url:'/pagesMy/jifen/withdraw',text:'积分兑换',num:0},
					{image:this.$baseUrl+'/static/my/icon14.png',url:'/pagesMy/jifen/record',text:'积分明细',num:0},
				],
				scoreInfo:{}
			};
		},
		onLoad(options) {
		},
		onShow() {
			this.getScoreInfo()
		},
		methods:{
			async getScoreInfo(){
				let res = await uni.$http('POST','score/index');
				console.log("积分信息",res);
				if(res.code == 1){
					this.scoreInfo = res.data;
				}else if(res.msg.includes('登录')){
					uni.setStorageSync('token',0);
				}
			},
			toAddBank(){
				uni.navigateTo({
					url:"/pagesMy/jifen/addBank"
				})
			},
			toPage(item){
				uni.navigateTo({
					url:item.url
				})
			},
			toRechange(){
				uni.navigateTo({
					url:"/pagesMy/jifen/recharge"
				})
			}
		}
	}
</script>

<style scoped lang="scss">
.pagesBox{
	.pagesMain{
		padding: 24rpx 24rpx;
		.jifenBox{
			height: 200rpx;
			color: #fff;
			background-color: var(--color);
			border-radius: 16rpx;
			display: flex;
			flex-direction: column;
			justify-content: center;
			align-items: center;
			position: relative;
			.jifenTitle{
				font-size: 32rpx;
			}
			.jifenNum{
				font-size: 32rpx;
				font-weight: 600;
				margin-top: 16rpx;
			}
			.rechargeBtn{
				width: 120rpx;
				height: 50rpx;
				color: var(--color);
				font-size: 26rpx;
				background-color: #fff;
				box-shadow: 0rpx 0rpx 6rpx #15563c;
				border-radius: 24rpx;
				display: flex;
				justify-content: center;
				align-items: center;
				position: absolute;
				right: 32rpx;
				bottom: 32rpx;
			}
			.rechargeHover{
				color: #1d7853;
				background-color: #f3fff0;
			}
		}
		.cardNoBox{
			height: 140rpx;
			color: #000;
			background-color: #fff;
			border-radius: 16rpx;
			padding: 0% 24rpx;
			margin-top: 16rpx;
			display: flex;
			justify-content: space-between;
			align-items: center;
			.cardNoTitle{
				font-size: 32rpx;
			}
			.cardNoRight{
				color: #5e2400;
				font-size: 28rpx;
				font-weight: 600;
				letter-spacing: 2rpx;
				.addCardNo{
					background-color: #fbd09b;
					border-radius: 16rpx;
					padding: 24rpx 36rpx;
				}
				.bankBox{
					color: #000;
					.bankName{
						font-size: 32rpx;
					}
					.bankNum{
						font-size: 24rpx;
						font-weight: 500;
						margin-top: 16rpx;
					}
				}
			}
		}
		.myOrderBox{
			background-color: #FFFFFF;
			border-radius: 16rpx;
			padding: 36rpx 24rpx;
			margin: 16rpx 0rpx;
			.titleBox{
			    color: #FCDFB0;
			    margin-bottom: 36rpx;
			    display: flex;
				justify-content: space-between;
			    align-items: center;
			    .titleLeft{
					font-weight: 600;
					font-size: 28rpx;
					color: #16202B;
			        margin-right: 10rpx;
			        display: flex;
			    }
			    .titleRight{
					font-weight: 600;
					font-size: 26rpx;
					color: #04449E;
			        word-break: break-all;
					display: flex;
					justify-content: flex-end;
					align-items: center;
			    }
			}
			.menuBox{
				display: flex;
				justify-content: space-between;
				align-items: center;
				.menuItem{
					width: 20%;
					display: flex;
					flex-direction: column;
					justify-content: space-between;
					align-items: center;
					.menuImage{
						font-size: 0%;
						display: flex;
						justify-content: center;
						align-items: center;
						position: relative;
					}
					.menuText{
						font-weight: 400;
						font-size: 24rpx;
						color: #444C55;
						margin-top: 18rpx;
					}
				}
			}
			.totalMain{
				margin-top: 24rpx;
				display: flex;
				justify-content: space-between;
				align-items: center;
				.itemBox{
					width: 49%;
					background: #EBF3FF;
					border-radius: 8rpx 8rpx 8rpx 8rpx;
					padding: 16rpx;
					.itemTitle{
						font-weight: 400;
						font-size: 24rpx;
						color: #A1A5AA;
						display: flex;
						justify-content: space-between;
						align-items: center;
						.itemTitleRight{
							font-weight: 400;
							font-size: 24rpx;
							color: #04449E;
							display: flex;
							justify-content: center;
							align-items: center;
						}
					}
					.itemMoney{
						font-weight: 600;
						font-size: 34rpx;
						color: #16202B;
						margin-top: 4rpx;
					}
				}
			}
		}
	}
}
</style>
<style>
	page{
		background-color: #F7F8FA;
	}
</style>
